#include "Solider.h"
#include "Gun.h"
#include <string.h>

Solider::Solider(const std::string &name) {
    this->name = name;
    this->ptr_gun = nullptr;
}

void Solider::addGun(Gun *ptr_gun) {
    this->ptr_gun = ptr_gun;
}

void Solider::addBullet2Gun(int count) {
    this->ptr_gun->addBullet(count);
}

bool Solider::fire() {
    return this->ptr_gun->shoot();
}

Solider::~Solider() {
    if (this->ptr_gun != nullptr) {
        delete this->ptr_gun;
        this->ptr_gun = nullptr;
    }
}